import request from '@/utils/request.js'

/**
 * 频道新闻推荐
 * @param {Object} params {channel_id,timestamp,with_top}
 * @returns {Promise}
 */
export function getArticles (params) {
  return request({
    url: '/v1_1/articles',
    params
  })
}

/**
 * 全部频道列表
 * @returns
 */
export function getAllChannels () {
  return request({
    url: '/v1_0/channels'
  })
}

/**
 * 设置用户频道列表（增量式）
 * @param {Object} params {id,seq}
 * @returns
 */
export function addUserChannels (params) {
  return request({
    url: '/v1_0/user/channels',
    method: 'PATCH',
    data: {
      channels: [params]
    }
  })
}

/**
 * 删除指定用户频道
 * @param {*} id 用户频道id
 * @returns
 */
export function delUserChannels (id) {
  return request({
    url: '/v1_0/user/channels/' + id,
    method: 'DELETE'
  })
}
